home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c_course.zip / STRUCT1.C < prev    next >
Text File  |  1989-12-30  |  640b  |  24 lines

  1. main()
  2. {
  3.  
  4. struct {
  5.    char initial;    /* last name initial      */
  6.    int age;         /* childs age             */
  7.    int grade;       /* childs grade in school */
  8.    } boy,girl;
  9.  
  10.    boy.initial = 'R';
  11.    boy.age = 15;
  12.    boy.grade = 75;
  13.  
  14.    girl.age = boy.age - 1;  /* she is one year younger */
  15.    girl.grade = 82;
  16.    girl.initial = 'H';
  17.  
  18.    printf("%c is %d years old and got a grade of %d\n",
  19.            girl.initial, girl.age, girl.grade);
  20.  
  21.    printf("%c is %d years old and got a grade of %d\n",
  22.            boy.initial, boy.age, boy.grade);
  23. }
  24.